<?php include("/includes/header.php") ?>
<?php include("/includes/sidebar.php") ?>

<div class="header">
	<span>
		<a href="menu.php">
			<i class="fa fa-cutlery"></i> Menu List
		</a>
	</span>
	<span>
		<a href="menu-form.php?act=new">
			<i class="fa fa-plus"></i> Add Menu
		</a>
	</span>
</div>

<div class="content row-fluid"> 
	<div class="span12 table-placer" data-table="menu" data-prim-field="id">
		<div class="alert alert-info"><h4>Menu Listing</h4></div>
		<table class="table table-striped" id="data_table">
			<thead>
				<tr>
					<th>
						<i class="fa fa-square-o opa3 check-all" data-toggle="tooltip" title="Check all"></i>
						<input type="checkbox" class="check-real-all hide">
					</th>
					<th>No</th>
					<th>Name</th>
					<th>Code</th>
					<th>Price</th>
					<th>Notes</th>
					<th>User</th>
					<th>Status</th>
					<th></th>
				</tr>
			</thead>
			<tbody>
				<?php  
					$sql_menu = "SELECT * FROM menu";
					$query_menu = mysql_query($sql_menu);
					$i = 1;
					while ($result_menu = mysql_fetch_array($query_menu)) {
				?>
					<tr>
						<td>
							<i class="fa fa-square-o opa3 check"></i>
							<input type="checkbox" class="check-real hide" value="<?php echo $result_menu[id] ?>">
						</td>
						<td><?php echo $i; ?></td>
						<td><?php echo $result_menu[nama]; ?></td>
						<td><?php echo $result_menu[kode]; ?></td>
						<td class="currency"><?php echo $result_menu[harga]; ?></td>
						<td><?php echo $result_menu[keterangan] ?></td>
						<td>
							<?php  
								if ($result_menu[iduser] == 0) {
									echo "Tuhan Yang Maha Esa";
								} else {
									$sql_user = "SELECT * FROM user WHERE id = '$result_menu[iduser]'";
									$query_user = mysql_query($sql_user);
									$result_user = mysql_fetch_array($query_user);
									echo $result_user['nama'];
								}
							?>
						</td>
						<td>
							<?php  
								if ($result_menu['is_active'] == 0) {
									echo "Inactive";
								} else {
									echo "Active";
								}
							?>
						</td>
						<td>
							<a href="/menu-form.php?act=edit&id=<?php echo $result_menu[id]; ?>">
								<i class="fa fa-pencil" data-toggle="tooltip" title="Edit <?php echo $result_menu['nama']; ?>"></i>
							</a>
						</td>
					</tr>
				<?php
						$i++;
					}
				?>
			</tbody>
		</table>
		<ul class="breadcrumb well">
			<button class="btn btn-danger btn-hapus disabled" data-toggle="tooltip" title="Delete data">
				<i class="fa fa-trash"></i> Delete
			</button>
		</ul>
	</div>           
</div>

<div class="footer">
</div>

<?php include("/includes/footer.php") ?>   

<script type="text/javascript">
	$(document).ready(function() {
		$('#data_table').dataTable( {
			"sDom": "<'row'<'span6'l><'span6'f>r>t<'row'<'span6'i><'span6'p>>",
			"sPaginationType": "bootstrap",
			"aoColumns": [
				{ "sClass": "center", "bSearchable": false, "bSortable": false },
				{ "sClass": "center", "bSearchable": false, "bSortable": false},
				{ "sClass": "left", "bSearchable": true, "bSortable": true },
				{ "sClass": "left", "bSearchable": true, "bSortable": true },
				{ "sClass": "left", "bSearchable": true, "bSortable": true },
				{ "sClass": "left", "bSearchable": true, "bSortable": true },
				{ "sClass": "left", "bSearchable": true, "bSortable": true },
				{ "sClass": "left", "bSearchable": true, "bSortable": true },
				{ "sClass": "left", "bSearchable": false, "bSortable": false }
			],
			"oLanguage": {
				"sLengthMenu": "_MENU_ data of page"
			}
		})
	});
</script>        